package org.swan.web.util;

import java.util.Arrays;

public class ConsoleUtil {
    public static String style(String str, ConsoleStyle... styles) {
        StringBuilder sb = new StringBuilder();
        Arrays.stream(styles).forEach(style -> sb.append(style.getStyle()));
        sb.append(str);
        sb.append(ConsoleStyle.RESET.getStyle());
        return sb.toString();
    }

    public static String fill(String str, char prefix, int length) {
        char[] cs = new char[length];
        Arrays.fill(cs, prefix);
        System.arraycopy(str.toCharArray(), 0, cs, length - str.length(), str.length());
        return new String(cs);
    }
}
